package com.xiaohao.communication.service;

import com.xiaohao.communication.bean.Integration;
import com.xiaohao.communication.dao.UserIntegrationDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserIntegrationService {


    @Autowired
    UserIntegrationDao userIntegrationDao;

    /*
    * 查询用户积分
    * */
    public Integration getUserIntegration(int id){
        List<Integration> userIntegration = userIntegrationDao.getUserIntegration(id);
        Integration integration = userIntegration.get(0);
        return integration;
    }

    /*
     * 增加用户积分
     * */
    public void addUserIntegration(Integration integration){
        userIntegrationDao.addUserIntegration(integration);

    }
    /*
    * 减少用户积分
    * */
    public void reduceUserIntegration(Integration integration){
        userIntegrationDao.reduceUserIntegration(integration);

    }

}
